package com.ntschy.bt.entity.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author lxr
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum BtSupplyShopTypeEnum implements IEnum<Integer> {

    /**
     * 供需类型 1-厂房出租 2-委托加工 3-产品供求 4-楼宇信息
     */
    WORKSHOP_RENT(1, "厂房出租"),
    COMMISSION_MANUFACTURER(2, "委托加工"),
    PRODUCT_SUPPLY_DEMAND(3, "产品供求"),
    BUILDING_INFO(4, "楼宇信息");


    private final int value;

    //@JsonValue
    private final String desc;

    BtSupplyShopTypeEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return desc;
    }

    @JsonCreator
    public static BtSupplyShopTypeEnum getBtSupplyShopTypeFromValue(int value) {
        for (BtSupplyShopTypeEnum companyType : BtSupplyShopTypeEnum.values()) {
            if(companyType.getValue() == value) {
                return companyType;
            }
        }
        return null;
    }
}
